<?php
class Upload{
	protected $_name;
	protected $_type;
	protected $_tmp;
	protected $_size; 
	protected $_path="upload/";
	public function __construct($file){
		$this->setName($file['name']);
		$this->setTmp($file['tmp_name']);
		$this->setType($file['type']);
		$this->setSize($file['size']);
	}
	public function setName($n){
		$this->_name=$n;
	}
	public function getName(){
		return $this->_name;
	}
	public function setTmp($tmp){
		$this->_tmp=$tmp;
	}
	public function getTmp(){
		return $this->_tmp;
	}
	public function setType($type){
		$this->_type=$type;
	}
	public function getType(){
		return $this->_type;
	}
	public function setSize($s){
		$this->_size=$s;
	}
	public function getSize(){
		return $this->_size;
	}
	public function setPath($p){
		$this->_path=$p;
	}	
	public function getPath(){
		return $this->_path;
	}
	public function do_upload(){
		if($this->getName() != ""){
			move_uploaded_file($this->getTmp(),$this->getPath().$this->getName());
			//move_uploaded_file("Ten tam","duong dan toi thu muc tren web server va ten hinh") 
			//$muser->setAvatar($upload->getName())
			return TRUE;
		}else{
			return FALSE;
		}
	}		

}
?>